<%@page import="com.kit.authority.entity.User"%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<base target="_self" />
<title>用户意见反馈</title>
<%@include file="/common/include.jsp"%>
<%  String username = "";
        Object sessionValues= request.getSession().getAttribute("currentUser");
        User user = (User)sessionValues;
        username = user.getUserName();
         if("".equals(sessionValues)&&sessionValues==null)username="admin";%> 
<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script>

function save(typeId,flagId,opinionId){
	var opinionPersion = document.getElementById("username").value ;
	var opinionContext = document.getElementById("opinionContext").value;
	
    if($.trim(opinionContext)==""){alert("回复内容不能空！"); 
    document.getElementById("opinionContext").focus();return;}	
    
    if(opinionContext.length>500){
    	alert("回复内容过长！500汉字以内！"); 
        document.getElementById("opinionContext").focus();return;
    }
	 $.ajax({
		type:'post', 
		url:'opinionAction!toSaveOpinion.action', 
		data:'opinionContext='+opinionContext+'&username='+opinionPersion+'&opinionType='+typeId+'&opinionId='+opinionId+'&flags='+flagId+'&parentId='+opinionId, 
		dataType:'text', 
		success:function(msg){
		   alert("保存成功！");
		   document.getElementById("opinionContext").value="";	   
		   document.getElementById("reloads").click();
		   window.returnValue='refresh'; 
		   window.close();
		},
		error:function(){}
		}) ; 
}
function remove(str){
	    $.ajax({
			type:'post', 
			url:'opinionAction!toRemoveOpinion.action', 
			data:'removeIds='+str, 
			dataType:'text', 
			success:function(msg){
			   alert("删除成功！");
			   document.getElementById("opinionContext").value="";	   
			   document.getElementById("reloads").click();
			   window.returnValue='refresh'; 
			   window.close();
			},
			error:function(){ }
			}) ; 
}

</script>
<style type="text/css">
.replyMargin {
	margin-left: 50%
}

.replyList {
	margin-left: 20%;
	width: 50%;
	height: auto;
	min-height: 80px;
	background-color: #989898
}

<!--
.STYLE1 {
	color: #990000;
	font-weight: bold;
}
#wrap{word-break:break-all;width:200px; overflow:auto; } 
-->
</style>
</head>

<body>
    <a id="reloads" href="opinionAction!toGetReversionList.action?pid=${opvo.id }" style="display:none"></a> 
	<TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 class="tabg">
		<TBODY>
			<TR class="tr1">
				<TD colspan="4"><b>[${opvo.opinionTitle }] </b> ${opvo.opinionContext }</TD>
				 <input type="hidden" id = "pid" name="pid" value="${opvo.id }" />
			</TR>
			<%int i=0 ;%>
			<c:forEach var="item" items="${volist }">
			<tr height="26" class="tr2">
				<td width="80%" align="left">
				<span id="title1">  <%=i+1%>楼   <font color="bluee"> <b>${item.anwerPerson } </b></font>   ${item.opinionTime }回复</span>&nbsp;&nbsp;&nbsp;
				 <a href="#" onclick="remove('${item.id }')" >删除</a></td>
			</tr>
			<tr height="60" class="tr3">
				<td colspan="3" align="left">&nbsp;&nbsp;<span class="#wrap">${item.opinionContext }</span></td>
			</tr>
 
			 <%i++;%>
			</c:forEach>
		 
		</TBODY>
	</TABLE>
	<p></p>
	<p></p>
  	<TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 class="tabg">
		<TBODY>
			<TR class="tr1">
				<TD colspan="2">意见回复</TD>
			</TR>
			<form id="submitForm" method="post" action="opinionAction!toSaveOpinion.action">
			<tr class="tab">	
			   <input  type="hidden" id = "username" name="username" value="<%=username %>" >
				<td><textarea  rows="5" id="opinionContext" name="opinionContext" style="width: 500px; resize: none;"></textarea> </td>
			</tr>
			<TR class="tab">
				<TD height="26" colspan="2">
					<p style="text-align: left">
						<input type="button" value="提交" id="submit" onclick="save(2,'null','${opvo.id }')" style="width: 80px;">	 
					</p>
				</TD>
			</TR>
		</TBODY>
	</TABLE>
     
</body>
</html>

